﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HREntities
{
    public class Employee : TaxEntity
    {
        public const decimal TAXRATE = .0765m;

        private decimal salary;
        private decimal ytdPay;
        private decimal ytdTaxes;

        public Employee()
            : this("J Doe", "000-00-0000")
        {
        }

        public Employee(string name, string ssn)
            : this(name, ssn, 100m)
        {
        }

        public Employee(string name, string ssn, decimal salary)
            : base (name, new SSN(ssn))
        {
            Salary = salary;
            ytdTaxes = 0;
            ytdPay = 0;
        }

 

        public decimal Salary
        {
            get { return salary; }
            set { salary = value; }
        }

        public decimal YtdSalary
        { get { return ytdPay; } }
        public decimal YtdTaxes
        { get { return ytdTaxes; } }


        public override decimal Pay()
        {
            decimal tax;
            decimal taxrate = TAXRATE;
            tax = Salary * taxrate;
            ytdTaxes += tax;
            ytdPay += Salary;
            return Salary - tax;
        }

     
    }
}
